/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vical.view;

import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import vical.controller.EntryController;
import vical.model.Internationalization;
import vical.view.model.CategoriesComboBoxModel;

/**
 * Panel that contains a check box with categories that are to be selected for highlighting 
 * respective DayCards with Animation
 * @author MONICA KUMAR
 */
public class DayCardHighlightPanel extends JPanel {

    private JComboBox categoriesCombobox;
    private JLabel highlightTaskLabel;
    private String userEntry;
    private Thread animation;
    private ViewPanel viewPanel;

    public DayCardHighlightPanel(final ViewPanel viewPanel) {

        this.viewPanel = viewPanel;

        highlightTaskLabel = new JLabel(Internationalization.getString("calendar_highlight_label"), (int) CENTER_ALIGNMENT);
        categoriesCombobox = new JComboBox(new CategoriesComboBoxModel(EntryController.getCategories()));
        categoriesCombobox.setToolTipText(Internationalization.getString("tooltip_highlight"));

        this.setLayout(new FlowLayout(FlowLayout.LEFT));
        this.add(highlightTaskLabel);
        this.add(categoriesCombobox);
//        this.setBackground(new Color(189, 198, 207));

        categoriesCombobox.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                final JComboBox cb = (JComboBox) e.getSource();
                viewPanel.highlightEntriesByCategory((String) cb.getSelectedItem());
            }
        });
    }

    public void updateCategory() {
        categoriesCombobox.setModel(new CategoriesComboBoxModel(EntryController.getCategories()));
    }
}
